﻿import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class BufferedReader {
	public static void main(String[] args) {
		Reader fr=null;
		BufferedReader br=null;
		
		try {
			fr=new FileReader("d:\\1.txt");
			br=new BufferedReader(fr);
			//2.读取文本文件

			String line=null;//读取到的信息

			while((line=br.readLine())!=null){
				System.out.println(line);
			}
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block

			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block

			e.printStackTrace();
		}finally{
			//3.关闭流

			if(fr!=null)
			try {
				fr.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block

				e.printStackTrace();
			}
		}
		if(br!=null){
			try {
				br.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block

				e.printStackTrace();
			}
		}
	}
}